﻿using System.IO;
using System.Diagnostics;

namespace SlideShowDFG2
{
    public static class VideoHelper
    {
        public static readonly string[] VIDEO_EXTENTSIONS = { ".wmv", ".asf" };

        public static bool IsFFMpegInstalled()
        {
            RegistryHelper registry = new RegistryHelper();
            return File.Exists(registry.FFmpegExe);
        }

        public static void ConvertVideo(string inputFile, string outputFile)
        {
            using (Process process = new Process())
            {
                RegistryHelper registry = new RegistryHelper();

                process.StartInfo.Arguments = string.Format("-i \"{0}\" -b {1} -s {2} -r 30 -f wmv2 \"{3}\"",
                                                                inputFile, registry.VideoBitrate, registry.VideoSize, outputFile);

                process.StartInfo.CreateNoWindow = true;
                process.StartInfo.FileName = registry.FFmpegExe;
                process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;

                process.Start();

                process.Close();
                process.Dispose();
            }
        }
    }
}
